package com.wzdigit.wms.wms.mapper.inv.count;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sun.org.apache.xpath.internal.operations.Bool;
import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.wms.basic.domain.basic.Sku;
import com.wzdigit.wms.basic.domain.basic.SkuCate;
import com.wzdigit.wms.basic.domain.inventory.Lotno;
import com.wzdigit.wms.wms.client.request.inv.count.dto.ReDifCountDtl;
import com.wzdigit.wms.wms.client.response.inv.count.*;
import com.wzdigit.wms.wms.client.response.inv.count.dto.InvLocDto;
import com.wzdigit.wms.wms.client.response.inv.count.dto.InvSeqDto;
import com.wzdigit.wms.wms.domain.dto.inv.count.*;
import com.wzdigit.wms.wms.domain.inv.count.InvCountDtl;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 
 * @since 2021-10-08
 */

@MyBatisRepository
public interface InvCountDtlMapper extends BaseMapper<InvCountDtl> {

    List<InvCountDtlCountResponse> selectCount(@Param("dtlRequest") InvCountDtlRequest dtlRequest, @Param("skuIds") List<Integer> skuIds);
    //更新实盘数
    void updateCountQtyById(@Param("addQty") BigDecimal addQty,@Param("id") BigDecimal invCountDtlId,@Param("loginName")String loginName);

    Integer selectTotalCountByHeaderId(@Param("headerId") BigDecimal headerId,@Param("status")Integer status,@Param("isFirst") Boolean isFirst);

    int selectMaxLineNo(@Param("headerId") BigDecimal headerId);

    List<CountDtlResponse> selectDtlReport(@Param("headerId") BigDecimal headerId);
    List<ReCountDtlResponse> selectReDtlReport(@Param("headerId") BigDecimal headerId);

    List<CountDtlGoodsRespone> slectDtlGoods(@Param("countDltId") BigDecimal countDltId);

    CountDtlGoodsRespone slectReDtlGoods(@Param("countDltId") BigDecimal countDltId,@Param("goodsSn") String goodsSn );

    List<InvCountDtlResponse> selectDetailList(@Param("headerId") BigDecimal headerId, @Param("skuCode") String skuCode, @Param("status") Integer status, @Param("isFirst") Boolean isFirst);

    List<InvCountDtlResponse> selectStockDetailList(@Param("headerId") BigDecimal headerId, @Param("locCode") String locCode, @Param("status") Integer status, @Param("isFirst") Boolean isFirst);

    List<InvCountDtlCountResponse> selectCountStock(@Param("dtlRequest") InvCountDtlRequest dtlRequest,@Param("whsIds") List<Integer> whsIds,@Param("zoneIds") List<Integer> zoneIds);

    List<CountAllResultResponse> slectAllResult(@Param("headerId") BigDecimal headerId);

    //复盘批次号下拉框
    List<Lotno> selectReLotnos(@Param("headerId") BigDecimal headerId);

    //复盘物料分类下拉框
    List<SkuCate> selectCates(@Param("headerId") BigDecimal headerId);

    //复盘物料下拉框
    List<Sku> selectSkus(@Param("headerId") BigDecimal headerId);

    //查询差异的盘点任务ID
    List<BigDecimal> selectDifReIds(@Param("headerId") BigDecimal headerId);

    //根据sku&lotno查询要复盘的任务ID
    List<BigDecimal> selectReIds(@Param("headerId") BigDecimal headerId,
                                 @Param("lotnos") List<String> lotnos,
                                 @Param("skuIds") List<Integer> skuIds);

    //更新盘点任务的最后复盘任务ID
    int updateReplayInfo(@Param("oldIds") List<BigDecimal> oldIds,@Param("reCountId") BigDecimal reCountId,
                         @Param("modifyUser") String modifyUser);

    //查询盘点结果明细
    List<CountAprResultResponse> selectAprResultDtl(@Param("headerId") BigDecimal headerId);

    //查询复盘履历
    List<InvSeqDto> selectSeqDto(@Param("dtlIdList")  List<BigDecimal> dtlIdList);

    //查询复盘过且存在差异的初盘单信息
    List<ReDifCountDtl> selectReDif(@Param("headerId")   BigDecimal headerId);

    int updateDtlBySapDifRequest(@Param("request") InvCountSapDifRequest request, @Param("noNeedBack") Integer noNeedBack);

    InvCountDtlResponse selectDetailInfo(@Param("dtlId") BigDecimal dtlId);

    int updateResultNull(@Param("dtlId") BigDecimal invCountDtlId);

    List<BigDecimal> selectNotCloseDtl(@Param("dto") InvLocDto invLocDto);
}
